﻿using System;
using System.Data.Objects;
using System.Linq;
using NopSolutions.NopCommerce.BusinessLogic.Data;
using NopSolutions.NopCommerce.BusinessLogic.Model;

namespace NopSolutions.NopCommerce.BusinessLogic.Services
{
    public class LocalizationCompiledQueries
    {
        public static readonly Func<NopObjectContext, int, IQueryable<LocaleStringResource>> LocaleStringResourcesByLanguageId =
            CompiledQuery.Compile<NopObjectContext, int, IQueryable<LocaleStringResource>>(
                    (ctx, languageId) =>
                        from l in ctx.LocaleStringResources
                        orderby l.ResourceName
                        where l.LanguageId == languageId
                        select l
            );
    }
}
